import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { crx } from '@crxjs/vite-plugin'
import { resolve } from 'path'
import manifest from './manifest.json' with { type: 'json' }

export default defineConfig({
  plugins: [
    vue(),
    crx({ manifest })
  ],
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src')
    }
  },
  build: {
    outDir: 'dist',
    emptyOutDir: true
  },
  legacy: {
    skipWebSocketTokenCheck: true
  },
  define: {
    'process.env': {},
    global: 'globalThis'
  },
  worker: {
    format: 'es'
  },
  esbuild: {
    pure: ["console.log", "console.info", "console.warn", "console.debug", "console.trace"]
  }
})
